package com.xbao.dao;

import com.xbao.model.PeriodRule;
import com.xbao.model.vo.StuVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by qingshengzheng on 2019/1/20.
 */
@Mapper
public interface StuExtraMapper {
    @Select("select sum(remainperiods) as remains,sid from stu_account group by sid where orgid=#{orgid} having sum(remainperiods)<#{remains}")
    public List<StuVo> remainRecordStus(Integer remain,Long orgid);

    @Select("select count(1) from stu_account group by sid where orgid=#{orgid} having sum(remainperiods)<#{remains}")
    public Integer remainRecordStusCount(Integer remain,Long orgid);


    @Select("select count(1) from stu_account group by sid where orgid=#{orgid} having max(endtime) &gt;= #{querystart} and max(endtime) &lt;= #{queryend}")
    public Integer  remainDayLtStuCount(Long querystart,Long queryend, Long orgid);

    @Select("select sid from stu_account group by sid where orgid=#{orgid} having max(endtime) &gt;= #{querystart} and max(endtime) &lt;= #{queryend}")
    public List<StuVo>  remainDayLtStu(Long querystart,Long queryend, Long orgid);
}
